<include file="Public/header"/>

<div class="x-nav">
      <span class="layui-breadcrumb">

      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" action="{:U('')}" method="get">
           
          <input class="layui-input" placeholder="赠送开始日" value="{:I('start')}" name="start" id="start">
	      <input class="layui-input" placeholder="赠送截止日"  value="{:I('end')}" name="end" id="end">
           <div class="layui-input-inline">
            <select name="status">
              <option value="0" selected='selected'>优惠卷状态</option>
              <option value="1" <if condition=" $status eq 1"> selected='selected' </if>>未使用</option>
              <option value="2" <if condition=" $status eq 2"> selected='selected' </if>>已绑定</option>
              <option value="3" <if condition=" $status eq 3"> selected='selected' </if>>已使用</option>
              <option value="4" <if condition=" $status eq 4"> selected='selected' </if>>已过期</option>
            </select>
          </div>
           <div class="layui-input-inline">
            <select name="quanid">
              <option value="0" selected='selected'>优惠卷类型</option>
              <foreach name="quan" item="v">
              <option value="{$v.id}" <if condition="$v['id']  eq $quanid"> selected='selected' </if>>{$v.tips}</option>
              </foreach>
            </select>
          </div>          
          <input type="text" name="uid"  value="{:I('uid')}" placeholder="请输入会员id" autocomplete="off" class="layui-input">
          
          <input type="text" name="reason"  value="{:I('reason')}" placeholder="请输入赠送原因" autocomplete="off" class="layui-input">

          <button class="layui-btn"   type="submit" ><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>
      <xblock>
        <button class="layui-btn layui-bg-red" onclick="delAll('','{:U('sendquandel')}')"><i class="layui-icon"></i>永久删除</button>
        <span class="x-right" style="line-height:40px">共有数据：{$count} 条</span>
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            <th>
              <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th>
            <th>ID</th>
            <th>会员信息</th>
            <th>优惠券信息</th>
            <th>优惠券状态</th>
            <th>获取时间</th>
            <th>使用时间</th>
            <th>截止时间</th>
            <th>获取方式</th>
            <th>赠送原因</th>
            </tr>
        </thead>
        <tbody>
        <volist name="list" id="vo">
          <tr>
            <td>
              <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id={$vo['id']}><i class="layui-icon">&#xe605;</i></div>
            </td>
            <td>{$vo['id']}</td>
            <td><img src="{$vo['acv']}" width="40" height="40">{$vo["nickname"]}|{$vo["mobile"]}|会员id：{$vo["uid"]}</td>
            <td>{$vo['tips']}</td>
            <td>
            	<if condition='$vo["status"] eq 1'>未使用</if>
            	<if condition='$vo["status"] eq 2'>已绑定</if>
            	<if condition='$vo["status"] eq 3'>已使用</if>
            	<if condition='$vo["status"] eq 4'>已过期</if>
            </td>
            <td>{$vo['addtime']|date="Y-m-d H:i:s",###}</td>
            <td>{$vo['usedtime']}</td>
            <td><if condition="$vo.end_time gt 0">{$vo['end_time']|date='Y-m-d H:i:s',###}</if></td>
            <td>
            	<if condition='$vo["type"] eq 1'>领取</if>
            	<if condition='$vo["type"] eq 2'>赠送</if>
            </td>
            <td>{$vo['reason']}</td>
          </tr>
        </volist>


        </tbody>
      </table>
      <div class="page" id="page">
        {$page}
      </div>

    </div>
    <script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });

       /*用户-停用*/
      function member_stop(obj,id){
          layer.confirm('确认要停用吗？',function(index){

              if($(obj).attr('title')=='启用'){

                //发异步把用户状态进行更改
                $(obj).attr('title','停用')
                $(obj).find('i').html('&#xe62f;');

                $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
                layer.msg('已停用!',{icon: 5,time:1000});

              }else{
                $(obj).attr('title','启用')
                $(obj).find('i').html('&#xe601;');

                $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
                layer.msg('已启用!',{icon: 5,time:1000});
              }
              
          });
      }


    </script>

<include file="Public/footer"/>

